/*
 * @Author: HaiF
 * @Date: 2020-11-30 21:39:19
 * @LastEditTime: 2020-12-17 22:17:01
 * @LastEditors: your name
 * @Description: 角色管理API
 * @FilePath: \adminPC\src\api\role.js
 * @可以输入预定的版权声明、个性签名、空行等
 */

import request from '@/utils/request'
const basePath = '/jpower-system'

export function getList(params) {
  return request({
    url: basePath + '/core/role/listTree',
    method: 'get',
    params
  })
}

/**
 * @description: 创建角色
 * @param {*} params
 * @return {*}
 */
export function createItem(params) {
  return request({
    url: basePath + '/core/role/add',
    method: 'post',
    params
  })
}

/**
 * @description: 更新角色
 * @param {*} params
 * @return {*}
 */
export function updateItem(params) {
  return request({
    url: basePath + '/core/role/update',
    method: 'put',
    params
  })
}

/**
 * @description: 删除角色
 * @param {*} params
 * @return {*}
 */
export function removeItem(ids) {
  return request({
    url: basePath + '/core/role/deleteStatus',
    method: 'delete',
    params: { ids }
  })
}

/**
 * @description: 查询角色权限
 * @param {*} roleId
 * @return {*}
 */
export function findFunction(roleId) {
  return request({
    url: basePath + '/core/role/roleFunction',
    method: 'get',
    params: { roleId }
  })
}

/**
 * @description: 角色权限
 * @param {*} params
 * @return {*}
 */
export function addFunction(params) {
  return request({
    url: basePath + '/core/role/addFunction',
    method: 'post',
    params
  })
}
